#ifndef __FRAME_H__
#define __FRAME_H__

#include "../libcomm.h"
#include "../shared/packet.h"
#include "conf.h"


typedef struct _table{
  WORD wPlayers[8];
  BYTE byStatus;
}TABLE *PTABLE;


#define DISPATCH_VARS struct ev_loop *loop,CONN_ITEM *item,void *data,int len
#define V_DISPATCH_VARS loop,item,data,len
#define GET_MAIN_SUB_CMD WORD wMCMD = *((WORD *)data);WORD wSCMD = *((WORD *)(data+2));
#define DATAADDR data+sizeof(WORD)*2

typedef int (*DATA_CALLBACK)(DISPATCH_VARS);

#define GAMEPROC(name) int name(DISPATCH_VARS)

int start_server(struct srvcnf *pconf,DATA_CALLBACK pfn_data_callback);

int on_dispatch(DISPATCH_VARS);
int getoption(int argc,const char **argv,struct srvcnf *pconf);

GAMEPROC(f_login);
GAMEPROC(f_reg);
GAMEPROC(f_userinfo);

GAMEPROC(f_entertable);
GAMEPROC(f_leavetable);
GAMEPROC(f_prepare);
GAMEPROC(f_userlist);


#endif
